package com.chinacoal.microservice;


import com.chinacoal.microservice.fallback.WorkOrderClientFallback;
import com.chinacoal.microservice.pojo.CcmsSmartleasingWorkOrder;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 运维管理-工单-对外开发接口类
 * @date 2020-12-16 17：52
 */
@Api(tags = {"运维管理-工单"})
@FeignClient(name = "${spring.application.name}",fallback = WorkOrderClientFallback.class,configuration = FeignAutoConfiguration.class)
public interface WorkOrderClient {

    /**
     * @Description: 查询所有的工单信息（带分页）
     * @author zhuliang
     * @date 2020/12/16 17:59
     */
    @ApiOperation(value = "查询所有的工单信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体类", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/workOrder/getAllByPage")
    public Result<List<CcmsSmartleasingWorkOrder>>  getAllByPage(@RequestBody QueryCriteria queryCriteria,
                                                                 @RequestHeader("token") String token);

    /**
     * @Description: 条件查询所有的工单信息（带分页）
     * @author zhuliang
     * @date 2020/12/16 18:00
     */
    @ApiOperation(value = "条件查询所有的工单信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体类", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/workOrder/getAllByCondition")
    public Result<List<CcmsSmartleasingWorkOrder>> getAllByCondition(@RequestBody QueryCriteria queryCriteria,
                                                                     @RequestHeader("token") String token);

    /**
     * @Description: 处理工单信息
     * @author zhuliang
     * @date 2020/12/16 18:34
     */
    @ApiOperation(value = "处理工单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "workOrder", value = "工单实体类", required = true, dataType = "CcmsSmartleasingWorkOrder"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PutMapping("smartleasing/workOrder/handleByWorkOrder")
    public Result handleByWorkOrder(@RequestBody CcmsSmartleasingWorkOrder workOrder,
                                    @RequestHeader(value = "token") String token);

    /**
     * @Description: 根据工单id查询工单信息
     * @author zhuliang
     * @date 2020/12/16 18:36
     */
    @ApiOperation(value = "根据工单id查询工单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkWorkOrderId", value = "工单id", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/workOrder/getWorkOrderById/{pkWorkOrderId}")
    public Result<CcmsSmartleasingWorkOrder> getWorkOrderById(@PathVariable(value = "pkWorkOrderId") String pkWorkOrderId);
}
